﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt.mssql
{
	// Token: 0x0200016D RID: 365
	public class TMssqlDeclare : TCustomSqlStatement
	{
		// Token: 0x17000256 RID: 598
		// (get) Token: 0x06000CA5 RID: 3237 RVA: 0x00307B46 File Offset: 0x00305D46
		// (set) Token: 0x06000CA6 RID: 3238 RVA: 0x00307B4E File Offset: 0x00305D4E
		public TSourceToken forKeyword
		{
			get
			{
				return this._forKeyword;
			}
			set
			{
				this._forKeyword = value;
			}
		}

		// Token: 0x06000CA7 RID: 3239 RVA: 0x00307B57 File Offset: 0x00305D57
		public TMssqlDeclare(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstmssqldeclare;
		}

		// Token: 0x06000CA8 RID: 3240 RVA: 0x00307B72 File Offset: 0x00305D72
		internal override void buildsql()
		{
		}

		// Token: 0x06000CA9 RID: 3241 RVA: 0x00307B74 File Offset: 0x00305D74
		internal override void clear()
		{
		}

		// Token: 0x06000CAA RID: 3242 RVA: 0x00307B76 File Offset: 0x00305D76
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000CAB RID: 3243 RVA: 0x00307B7D File Offset: 0x00305D7D
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x17000257 RID: 599
		// (get) Token: 0x06000CAC RID: 3244 RVA: 0x00307B7F File Offset: 0x00305D7F
		// (set) Token: 0x06000CAD RID: 3245 RVA: 0x00307B87 File Offset: 0x00305D87
		public virtual TObjectName CursorName
		{
			get
			{
				return this.cursorName;
			}
			set
			{
				this.cursorName = value;
			}
		}

		// Token: 0x17000258 RID: 600
		// (get) Token: 0x06000CAE RID: 3246 RVA: 0x00307B90 File Offset: 0x00305D90
		// (set) Token: 0x06000CAF RID: 3247 RVA: 0x00307B98 File Offset: 0x00305D98
		public virtual EDeclareType DeclareType
		{
			get
			{
				return this.declareType;
			}
			set
			{
				this.declareType = value;
			}
		}

		// Token: 0x17000259 RID: 601
		// (get) Token: 0x06000CB0 RID: 3248 RVA: 0x00307BA1 File Offset: 0x00305DA1
		// (set) Token: 0x06000CB1 RID: 3249 RVA: 0x00307BA9 File Offset: 0x00305DA9
		public virtual TSelectSqlStatement Subquery
		{
			get
			{
				return this.subquery;
			}
			set
			{
				this.subquery = value;
			}
		}

		// Token: 0x1700025A RID: 602
		// (get) Token: 0x06000CB2 RID: 3250 RVA: 0x00307BB2 File Offset: 0x00305DB2
		// (set) Token: 0x06000CB3 RID: 3251 RVA: 0x00307BBA File Offset: 0x00305DBA
		public virtual TDeclareVariableList Variables
		{
			get
			{
				return this.variables;
			}
			set
			{
				this.variables = value;
			}
		}

		// Token: 0x06000CB4 RID: 3252 RVA: 0x00307BC4 File Offset: 0x00305DC4
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			TDeclareSqlNode tdeclareSqlNode = (TDeclareSqlNode)this.rootNode;
			base.doParseStatement(psql);
			this.declareType = tdeclareSqlNode.DeclareType;
			this.cursorName = tdeclareSqlNode.CursorName;
			if (this.declareType == EDeclareType.variable)
			{
				this.variables = tdeclareSqlNode.Variables;
			}
			if (tdeclareSqlNode.SelectSqlNode != null)
			{
				this.subquery = new TSelectSqlStatement(this.dbvendor);
				this.subquery.rootNode = tdeclareSqlNode.SelectSqlNode;
				this.subquery.doParseStatement(this);
			}
			return 0;
		}

		// Token: 0x06000CB5 RID: 3253 RVA: 0x00307C54 File Offset: 0x00305E54
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000CB6 RID: 3254 RVA: 0x00307C64 File Offset: 0x00305E64
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.subquery != null)
			{
				this.subquery.acceptChildren(v);
			}
			v.postVisit(this);
		}

		// Token: 0x040012EE RID: 4846
		private TSourceToken _forKeyword;

		// Token: 0x040012EF RID: 4847
		private TSelectSqlStatement subquery;

		// Token: 0x040012F0 RID: 4848
		private TObjectName cursorName;

		// Token: 0x040012F1 RID: 4849
		private EDeclareType declareType = EDeclareType.variable;

		// Token: 0x040012F2 RID: 4850
		private TDeclareVariableList variables;
	}
}
